package com.projet.parse;

import com.core.common.FnKit;
import com.projet.erp.CloseUtil;
import com.projet.erp.ctx.DealVO;

import java.sql.Connection;
import java.util.List;

public class HzTableMain {
    public static void main(String[] args) {
        Connection connection = null;
        try {
            connection = Hz.getConn();
            String keyword = "国药集团威奇达药业有限公司青霉素原料车间水系统上位机，PLC自控改造";


            DealVO ctx = new DealVO().setConnection(connection);
            List<String> oriList = ParseTable.queryAllTable(connection);
            System.out.println("原始表,个数：" + oriList.size());
            List<String> tableList = ParseTable.filter(connection, oriList,10,null );
            System.out.println("过滤后,个数：" + tableList.size());


            for (int i = 0; i < tableList.size(); i++) {
                ParseTable.processTable(ctx, tableList.get(i), keyword,false);
                System.out.println(tableList.get(i) + " 处理完成，序号：" + (i + 1));
            }
//            System.out.println("未处理类型：" + FnKit.join(ctx.toOtherTypeList()));
            System.out.println("涉及到的表：\r\n" + FnKit.join(ctx.toResultList()));
            System.out.println("********************");
            for (String s : ctx.toResultList()) {
                System.out.println("select * from "+s+"  ;\n");
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            CloseUtil.deal(connection);
        }

    }


}
